﻿#ifndef TABLEVIEWHEADER_H
#define TABLEVIEWHEADER_H
#include <QHeaderView>
#include <QEvent>
#include <QPainter>
#include <QCheckBox>
#include <QMouseEvent>
#include <qnamespace.h>
#include <QDebug>

#define CHECK_BOX_COLUMN 0

class TableViewHeader :public QHeaderView
{
    Q_OBJECT
public:
    TableViewHeader(Qt::Orientation orientation,QWidget *parent = nullptr);

public:
    void onStateChanged(int state);
    bool isChecked();

signals:
    void stateChanged(Qt::CheckState);

protected:
    void paintSection(QPainter *painter, const QRect &rect, int logicalIndex) const;
    void mousePressEvent(QMouseEvent *event);
    void mouseReleaseEvent(QMouseEvent *event);
    // bool event(QEvent *event);

private:
    bool m_bPressed;
    bool m_bChecked;
    bool m_bTristate;
    bool m_bNoChange;
    bool m_bMoving;
};

#endif // TABLEVIEWHEADER_H
